// Chromis POS - The New Face of Open Source POS
// Copyright (c) (c) 2015-2016
// http://www.chromis.co.uk
//
// This file is part of Chromis POS
//
// Chromis POS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Chromis POS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Chromis POS. If not, see <http://www.gnu.org/licenses/>.
package uk.chromis.pos.config;
import java.awt.Component;
import uk.chromis.data.user.DirtyManager;
import uk.chromis.pos.forms.AppConfig;
/**
*
*
*/
public class JPanelConfigRestaurant extends javax.swing.JPanel implements PanelConfig {
private DirtyManager dirty = new DirtyManager();
public JPanelConfigRestaurant() {
initComponents();
jchkShowCustomerDetails.addActionListener(dirty);
jchkShowWaiterDetails.addActionListener(dirty);
jCustomerColour.addActionListener(dirty);
jWaiterColour.addActionListener(dirty);
jTableNameColour.addActionListener(dirty);
jAutoRefresh.addActionListener(dirty);
jTableDesign.addActionListener(dirty);
}
/**
*
* @return
*/
@Override
public boolean hasChanged() {
return dirty.isDirty();
}
/**
*
* @return
*/
@Override
public Component getConfigComponent() {
return this;
}
/**
*
* @param config
*/
@Override
public void loadProperties() {
jchkShowCustomerDetails.setSelected(AppConfig.getInstance().getBoolean("table.showcustomerdetails"));
jchkShowWaiterDetails.setSelected(AppConfig.getInstance().getBoolean("table.showwaiterdetails"));
jTableButtons.setSelected(AppConfig.getInstance().getBoolean("table.transparentbuttons"));
jAutoRefresh.setSelected(AppConfig.getInstance().getBoolean("tables.autorefresh"));
jTableDesign.setSelected(AppConfig.getInstance().getBoolean("tables.redesign"));
// hide some values until the code has been implmented
if (AppConfig.getInstance().getProperty("table.customercolour") == null) {
jCustomerColour.setSelectedItem("blue");
} else {
jCustomerColour.setSelectedItem(AppConfig.getInstance().getProperty("table.customercolour"));
}
if (AppConfig.getInstance().getProperty("table.waitercolour") == null) {
jWaiterColour.setSelectedItem("red");
} else {
jWaiterColour.setSelectedItem(AppConfig.getInstance().getProperty("table.waitercolour"));
}
if (AppConfig.getInstance().getProperty("table.tablecolour") == null) {
jTableNameColour.setSelectedItem("black");
} else {
jTableNameColour.setSelectedItem((AppConfig.getInstance().getProperty("table.tablecolour")));
}
dirty.setDirty(false);
}
/**
*
* @param config
*/
@Override
public void saveProperties() {
AppConfig.getInstance().setBoolean("table.showcustomerdetails", jchkShowCustomerDetails.isSelected());
AppConfig.getInstance().setBoolean("table.showwaiterdetails", jchkShowWaiterDetails.isSelected());
AppConfig.getInstance().setProperty("table.customercolour", jCustomerColour.getSelectedItem().toString());
AppConfig.getInstance().setProperty("table.waitercolour", jWaiterColour.getSelectedItem().toString());
AppConfig.getInstance().setProperty("table.tablecolour", jTableNameColour.getSelectedItem().toString());
AppConfig.getInstance().setBoolean("table.transparentbuttons", jTableButtons.isSelected());
AppConfig.getInstance().setBoolean("tables.autorefresh", jAutoRefresh.isSelected());
AppConfig.getInstance().setBoolean("tables.redesign", jTableDesign.isSelected());
dirty.setDirty(false);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jLabelCustomerTextColour = new javax.swing.JLabel();
jCustomerColour = new javax.swing.JComboBox();
jLabelServerTextColour = new javax.swing.JLabel();
jWaiterColour = new javax.swing.JComboBox();
jLabelTableNameTextColour = new javax.swing.JLabel();
jTableNameColour = new javax.swing.JComboBox();
jPanel1 = new javax.swing.JPanel();
jchkShowCustomerDetails = new eu.hansolo.custom.SteelCheckBox();
jchkShowWaiterDetails = new eu.hansolo.custom.SteelCheckBox();
jTableButtons = new eu.hansolo.custom.SteelCheckBox();
jTableDesign = new eu.hansolo.custom.SteelCheckBox();
jAutoRefresh = new eu.hansolo.custom.SteelCheckBox();
setMinimumSize(new java.awt.Dimension(700, 500));
setPreferredSize(new java.awt.Dimension(700, 650));
java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("pos_messages"); // NOI18N
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), bundle.getString("label.tabledisplayoptions"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 12), new java.awt.Color(102, 102, 102))); // NOI18N
jPanel3.setLayout(null);
jLabelCustomerTextColour.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jLabelCustomerTextColour.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabelCustomerTextColour.setText(bundle.getString("label.textcolourcustomer")); // NOI18N
jLabelCustomerTextColour.setMaximumSize(new java.awt.Dimension(0, 25));
jLabelCustomerTextColour.setMinimumSize(new java.awt.Dimension(0, 0));
jLabelCustomerTextColour.setPreferredSize(new java.awt.Dimension(0, 25));
jPanel3.add(jLabelCustomerTextColour);
jLabelCustomerTextColour.setBounds(240, 20, 130, 25);
jCustomerColour.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jCustomerColour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "black", "blue", "grey", "green", "orange", "red", "white", "yellow" }));
jCustomerColour.setMaximumSize(new java.awt.Dimension(0, 25));
jCustomerColour.setMinimumSize(new java.awt.Dimension(0, 0));
jCustomerColour.setPreferredSize(new java.awt.Dimension(0, 25));
jCustomerColour.setSelectedItem("blue");
jPanel3.add(jCustomerColour);
jCustomerColour.setBounds(380, 20, 200, 30);
jLabelServerTextColour.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jLabelServerTextColour.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabelServerTextColour.setText(bundle.getString("label.textcolourwaiter")); // NOI18N
jLabelServerTextColour.setMaximumSize(new java.awt.Dimension(0, 25));
jLabelServerTextColour.setMinimumSize(new java.awt.Dimension(0, 0));
jLabelServerTextColour.setPreferredSize(new java.awt.Dimension(0, 25));
jPanel3.add(jLabelServerTextColour);
jLabelServerTextColour.setBounds(240, 60, 130, 25);
jWaiterColour.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jWaiterColour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "black", "blue", "grey", "green", "orange", "red", "white", "yellow" }));
jWaiterColour.setMaximumSize(new java.awt.Dimension(0, 25));
jWaiterColour.setMinimumSize(new java.awt.Dimension(0, 0));
jWaiterColour.setPreferredSize(new java.awt.Dimension(0, 25));
jPanel3.add(jWaiterColour);
jWaiterColour.setBounds(380, 60, 200, 30);
jLabelTableNameTextColour.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
jLabelTableNameTextColour.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
jLabelTableNameTextColour.setText(bundle.getString("label.textclourtablename")); // NOI18N
jLabelTableNameTextColour.setMaximumSize(new java.awt.Dimension(0, 25));
jLabelTableNameTextColour.setMinimumSize(new java.awt.Dimension(0, 0));
jLabelTableNameTextColour.setPreferredSize(new java.awt.Dimension(0, 25));
jPanel3.add(jLabelTableNameTextColour);
jLabelTableNameTextColour.setBounds(230, 100, 140, 30);
jTableNameColour.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jTableNameColour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "black", "blue", "grey", "green", "orange", "red", "white", "yellow" }));
jTableNameColour.setMaximumSize(new java.awt.Dimension(0, 25));
jTableNameColour.setMinimumSize(new java.awt.Dimension(0, 0));
jTableNameColour.setPreferredSize(new java.awt.Dimension(0, 25));
jPanel3.add(jTableNameColour);
jTableNameColour.setBounds(380, 100, 200, 30);
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jchkShowCustomerDetails.setText(bundle.getString("label.tableshowcustomerdetails")); // NOI18N
jPanel1.add(jchkShowCustomerDetails, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 220, -1));
jchkShowWaiterDetails.setText(bundle.getString("label.tableshowwaiterdetails")); // NOI18N
jPanel1.add(jchkShowWaiterDetails, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 220, -1));
jTableButtons.setBorder(null);
jTableButtons.setText(bundle.getString("label.tablebuttons")); // NOI18N
jTableButtons.setUi(null);
jPanel1.add(jTableButtons, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 110, 220, -1));
jPanel3.add(jPanel1);
jPanel1.setBounds(10, 20, 220, 140);
jTableDesign.setText(bundle.getString("label.enabletablepositions")); // NOI18N
jPanel3.add(jTableDesign);
jTableDesign.setBounds(10, 190, 230, 30);
jAutoRefresh.setText(bundle.getString("label.autorefresh")); // NOI18N
jPanel3.add(jAutoRefresh);
jAutoRefresh.setBounds(10, 160, 210, 30);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 680, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(337, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private eu.hansolo.custom.SteelCheckBox jAutoRefresh;
private javax.swing.JComboBox jCustomerColour;
private javax.swing.JLabel jLabelCustomerTextColour;
private javax.swing.JLabel jLabelServerTextColour;
private javax.swing.JLabel jLabelTableNameTextColour;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private eu.hansolo.custom.SteelCheckBox jTableButtons;
private eu.hansolo.custom.SteelCheckBox jTableDesign;
private javax.swing.JComboBox jTableNameColour;
private javax.swing.JComboBox jWaiterColour;
private eu.hansolo.custom.SteelCheckBox jchkShowCustomerDetails;
private eu.hansolo.custom.SteelCheckBox jchkShowWaiterDetails;
// End of variables declaration//GEN-END:variables
}